//主对象
function fun_ecmmsMake_mainObj(mmsmake) {
	this.title = "";//标题
	this.msgType = "";//类别
	this.periodicalSubArr = new Array();//帧容器即子对象
	this.addSubObj = function addSubObj(subObj) {
		this.periodicalSubArr.push(subObj);
	}
	this.delSubObj = function delSubObj(subObj) {
		var tmpArray = new Array();
		for (var i = 0; i < this.periodicalSubArr.length; i++) {
			if (this.periodicalSubArr[i] != subObj) {
				tmpArray.push(this.periodicalSubArr[i]);
			}
		}
		this.periodicalSubArr = tmpArray;
	}
	
	this.insertSubObj = function insertSubObj(zhe,s) {
		var tmpArray = new Array();
		var leng =this.periodicalSubArr.length;
		var subObj;
		for (var i = 0; i < leng; i++) {
			if(i<(zhe-1)){
			    tmpArray.push(this.periodicalSubArr[i]);
			}else if(i==(zhe-1)){
		        tmpArray.push(s);
		    }else{
		    	subObj =this.periodicalSubArr[i-1];
		    	subObj.sort++;
		        tmpArray.push(subObj);
		    }
		}
		subObj=this.periodicalSubArr[leng-1];
		subObj.sort++;
		tmpArray.push(subObj);
		this.periodicalSubArr = tmpArray;
	}

	this.getSubObj = function getSubObj(index) {
		var curSubObj;
		for (var i = 0; i < this.periodicalSubArr.length; i++) {
			if (i == index) {
				curSubObj = this.periodicalSubArr[i];
				return curSubObj;
			}
		}
		return null;
	}
}

//子对象
function fun_ecmmsMake_subObj(mmsmake) {
	this.playTime = 10;//帧时间
	this.sort = mmsmake.sort;//第几帧
	this.textContent = ""; //文本内容
	this.textContentSize =0;
	
	this.picName = ""; //图片名称
	this.picSize = ""; //图片大小
	this.picType = ""; //图片类型
	this.picPath = ""; //图片的绝对路径，包含文件名
	this.picsoId = ""; //资源ID

	this.ringName = ""; //铃声名称
	this.ringSize = ""; //铃声大小
	this.ringType = ""; //铃声类型
	this.ringPath = ""; //铃声的绝对路径，包含文件名
	this.ringsoId = ""; //资源ID
}

//页面对象-新增新增EC自服务
function fun_ecmmsMake_pageObj(){
    this.mmssize=0;//帧大小KB
    this.mmsallsize=0;//总帧大小KB
    this.page= 1; //当前页数
    this.pagecount= 1; //总页数
    this.pagezise= 4; //每页放4个

    this.sortsourceIds =""//复选框源ID以，分开
    this.resultlength=0;//镐件列表的行数
    this.del =1;//删除帧号
    this.update =-1;//修改帧号
    this.insert =-1;//插入帧号
    this.lastsize=0;
    this.upmmssize =0; //当前修改帧原有大小
    
    this.textContent="";
    this.textContentSize=0;

    this.playTime=10;
    this.sort=1;
    this.allsort=0;
    
    this.picName = ""; 
	this.picSize = ""; 
	this.picType = ""; 
	this.picPath = ""; 
	this.picsoId = ""; //资源ID

	this.ringName = "";
	this.ringSize = "";
	this.ringType = "";
	this.ringPath = "";
	this.ringDownload ="";
	this.ringsoId = ""; //资源ID

}


//页面对象-修改
function fun_upecmmsMake_pageObj(){
	this.id=rowData.id;//快讯期刊ID
    this.title=rowData.title; //快讯期刊标题
    

    this.upmmssize =0; //当前修改帧原有大小
    this.mmssize=0;//帧大小KB
    this.mmsallsize=0;//总帧大小KB
    this.page= 1; //当前页数
    this.pagecount= 1; //总页数
    this.pagezise= 4; //每页放4个
    this.sourceId="";//存明细组稿ID以，分开
    this.sortsourceIds =""//复选框源ID以，分开
    this.resultlength=0;//镐件列表的行数
    
    this.del =1;//删除帧号
    this.update =-1;//修改帧号
    this.insert =-1;//插入帧号
    this.lastsize=0;
    
    this.textContent="";
    this.textContentSize=0;

    this.playTime=10;
    this.sort=1;
    this.allsort=0;
    this.picName = ""; 
	this.picSize = ""; 
	this.picType = ""; 
	this.picPath = ""; 
	this.picsoId = ""; //资源ID

	this.ringName = "";
	this.ringSize = "";
	this.ringType = "";
	this.ringPath = "";
	this.ringDownload ="";
	this.ringsoId = ""; //资源ID

}

//锁住选中项
function fun_mmsMake_lockData(zhe,arr){
    var s = arr[zhe-1];
    var arr =s.split(",");
    for(var j in arr) {
        $("#"+arr[j])[0].disabled = true;	
    }
}

//解锁选中项
function fun_mmsMake_nolockData(zhe,arr){
	var s = arr[zhe-1];
    var arr = s.split(",");
    for(var j in arr) {
        $("#"+arr[j])[0].disabled = false;
    }
}

//计算帧大小
function fun_mms_zsize(mmsmake,size) {
	if (typeof(size) == "string") {
		size = parseInt(size);
	}
	mmsmake.mmssize += size;//帧大小KB
	mmsmake.mmsallsize += size;//总帧大小KB
}

//计算总帧大小
function fun_mms_allsize(mmsmake) {
	mmsmake.mmsallsize += mmsmake.mmssize;//总帧大小KB
}

//修改帧后取消可选并己选中的复选框
function fun_mmsMake_clearCk(name){
     $("input[name='"+name+"']").each(function() {
          if($(this).attr("checked")&&!$(this).attr("disabled")){
              $(this).attr("disabled", true); 
          }
     }); 
}

//帧列表下拉
function mmsMakeDowndata(mmsmake,ids){
	if(mmsmake.pagecount==1){
		return;
	}
	if(mmsmake.page==mmsmake.pagecount){//最后一页时
	    $("#"+ids+(mmsmake.pagecount*mmsmake.pagezise-3)).hide();
	    $("#"+ids+(mmsmake.pagecount*mmsmake.pagezise-2)).hide();
	    $("#"+ids+(mmsmake.pagecount*mmsmake.pagezise-1)).hide();
	    $("#"+ids+(mmsmake.pagecount*mmsmake.pagezise)).hide();
	    $("#"+ids+"1").show();
	    $("#"+ids+"2").show();
	    $("#"+ids+"3").show();
	    $("#"+ids+"4").show();
	    mmsmake.page=1;
	}else{
	    $("#"+ids+(mmsmake.page*mmsmake.pagezise-3)).hide();
	    $("#"+ids+(mmsmake.page*mmsmake.pagezise-2)).hide();
	    $("#"+ids+(mmsmake.page*mmsmake.pagezise-1)).hide();
	    $("#"+ids+(mmsmake.page*mmsmake.pagezise)).hide();
	    $("#"+ids+(mmsmake.page*mmsmake.pagezise+1)).show();
	    $("#"+ids+(mmsmake.page*mmsmake.pagezise+2)).show();
	    $("#"+ids+(mmsmake.page*mmsmake.pagezise+3)).show();
	    $("#"+ids+(mmsmake.page*mmsmake.pagezise+4)).show();
	    mmsmake.page++;
	}
}
function tt(){

	alert(1)
}
//帧列表上拉
function mmsMakeUpdata(mmsmake,ids){
	if(mmsmake.pagecount==1){
		return;
	}
	if(mmsmake.page==1){//第一页时
	    $("#"+ids+"1").hide();
	    $("#"+ids+"2").hide();
	    $("#"+ids+"3").hide();
	    $("#"+ids+"4").hide();
	    $("#"+ids+(mmsmake.pagecount*mmsmake.pagezise-3)).show();
	    $("#"+ids+(mmsmake.pagecount*mmsmake.pagezise-2)).show();
	    $("#"+ids+(mmsmake.pagecount*mmsmake.pagezise-1)).show();
	    $("#"+ids+(mmsmake.pagecount*mmsmake.pagezise)).show();
	    mmsmake.page=mmsmake.pagecount;
	}else{
	    $("#"+ids+(mmsmake.page*mmsmake.pagezise-3)).hide();
	    $("#"+ids+(mmsmake.page*mmsmake.pagezise-2)).hide();
	    $("#"+ids+(mmsmake.page*mmsmake.pagezise-1)).hide();
	    $("#"+ids+(mmsmake.page*mmsmake.pagezise)).hide();
	    $("#"+ids+(mmsmake.page*mmsmake.pagezise-7)).show();
	    $("#"+ids+(mmsmake.page*mmsmake.pagezise-6)).show();
	    $("#"+ids+(mmsmake.page*mmsmake.pagezise-5)).show();
	    $("#"+ids+(mmsmake.page*mmsmake.pagezise-4)).show();
	    mmsmake.page--;
	}
}
